package com.lagou.edu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: ruanyaguang
 * @Date : 2020/4/24
 * @Info :
 */
@Controller
public class LoginController {
    @RequestMapping("/login")
    public String login(HttpServletRequest request, String username, String password) {
        if (null != request.getSession().getAttribute("username")) {
            return "redirect:/resume/list";
        }
        if ("admin".equals(username) && "admin".equals(password)) {
            request.getSession().setAttribute("username", username);
            return "redirect:/resume/list";
        }
        return "login";
    }
}